﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Windows.Forms;
namespace vfife_building_algorithm
{
    public static class Model
    {
        private static bool isset = false;

        public static bool Isset
        {
            get { return Model.isset; }
            set { Model.isset = value; }
        }

        private static Hashtable elements;

        public static Hashtable Elements
        {
            get { return elements; }
            set { elements = value; }
        }



        private static Caculation_Parameters caculation_parameters;

        public static Caculation_Parameters Caculation_parameters
        {
            get { return caculation_parameters; }
            set { caculation_parameters = value; }
        }

        public static void SetConNodes()
        {
            Hashtable AllElmts = Model.elements;
            Hashtable AllNodes = new Hashtable(); ;
            Node nodeselct1;
            Node nodeselct2;
            Element Elmt;
            for (int i = 1; i <= AllElmts.Count; i++)
            {
                Elmt = (Element)AllElmts[i];
                nodeselct1 = Elmt.node1;
                nodeselct2 = Elmt.node2;
                nodeselct1.ElmtConnected.Add(Elmt.Id, Elmt);
                nodeselct2.ElmtConnected.Add(Elmt.Id, Elmt);




                if (AllNodes.Contains(nodeselct1.Id) && (!AllNodes.Contains(nodeselct2.Id)))
                {
                    AllNodes.Add(nodeselct2.Id, nodeselct2);
                    //nodeselct2.elmtsConnected.Add(Elmt.id, Elmt);

                }
                if ((!AllNodes.Contains(nodeselct1.Id)) && AllNodes.Contains(nodeselct2.Id))
                {
                    AllNodes.Add(nodeselct1.Id, nodeselct1);
                    //nodeselct1.elmtsConnected.Add(Elmt.id, Elmt);
                }
                if ((!AllNodes.Contains(nodeselct1.Id)) && (!AllNodes.Contains(nodeselct2.Id)))
                {

                    AllNodes.Add(nodeselct1.Id, nodeselct1);
                    AllNodes.Add(nodeselct2.Id, nodeselct2);

                }
                if ((AllNodes.Contains(nodeselct1.Id)) && (AllNodes.Contains(nodeselct2.Id)))
                {



                }
            }
            

        }
    }
}
